package com.yequan.springmvc.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 
 * @author 灭霸詹
 *
 */
public abstract class AbstractsHttpServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	@Override
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//请求分发（查找处理器、执行处理器）
		doDispatch(request, response);
	}

	/**
	 * 核心逻辑
	 * @param request
	 * @param response
	 */
	public abstract void doDispatch(HttpServletRequest request, HttpServletResponse response); 
	
	@Override
	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
